<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>管理中心 -</title>
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="js/jquery/uploadify/uploadify.css" />
<link href="styles/general.css" rel="stylesheet" type="text/css" />
<link href="styles/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery/uploadify/jquery.min.js"></script>
<script src="js/jquery/uploadify/jquery.uploadify.js" type="text/javascript"></script>
<script src="js/utils.js" type="text/javascript"></script>
</head>
<body>
	<form id="theForm" method="post" name="theForm" onsubmit="return validate();" action="appversion_save.do?type=<s:property value="type"/>">
		 <h1>
			<span class="action-span"><a
				href="appversion_index.do?app.appnumber=<s:property value="app.appnumber"/>&cpid=<s:property value="cpid"/>&categoryparentid=<s:property value="categoryparentid"/>&appName=<s:property value="appName"/>">平台接入列表</a></span>
			<span class="action-span1"><a href="mainframe.jsp"> 首页</a> </span><span
				id="search_id" class="action-span1">- 平台接入管理 </span>
		</h1>
		<!-- start goods form -->
		<div class="tab-div">
			<!-- tab bar -->
			<div id="tabbar-div">
				<p>
					<span class="tab-front" id="general-tab">版本信息</span> 
					<span class="tab-front"><a href="app_show1.do?type=appversion&model.appnumber=<s:property value="app.appnumber" />&appversionid=<s:property value="model.id" />">物料下载</a></span> 
				</p>
			</div>
			<!-- tab body -->
			<div id="tabbody-div">
				<!-- 通用信息 -->
				<input type="hidden" name="model.createuser" id="model.createuser" value="<s:property value="model.createuser"/>" />
				<input type="hidden" name="model.createdate" id="model.createdate" value="<s:property value="model.createdate"/>" />
				<input type="hidden" name="model.appstatus" id="model.appstatus" value="<s:property value="model.appstatus"/>" />
				<input type="hidden" name="app.appnumber" id="app.appnumber" value="<s:property value="app.appnumber"/>" />
				<input type="hidden" name="model.id" id="model.id" value="<s:property value="model.id"/>" />
				<input type="hidden" name="model.appnumber" id="model.appnumber"  value="<s:property value="model.appnumber"/>" readonly="readonly" />
				<input type="hidden" id="model.cpid" name="model.cpid" value="<s:property value="model.cpid"/>" />
				<input type="hidden" id="model.categoryparentid" name="model.categoryparentid" value="<s:property value="model.categoryparentid"/>" />
				<input type="hidden" id="model.categoryid" name="model.categoryid" value="<s:property value="model.categoryid"/>" />
				<input type="hidden" id="model.recommend" name="model.recommend" value="<s:property value="model.recommend" />" />
				<s:if test='msg!=null&&"wl".equals(msg)'>
				<s:iterator value="aslist" status="i">
				<s:if test='"0".equals(type)'>
			  		<s:set name="tmp_icon" value="true" />
			 	</s:if>
			  	<s:if test='"1".equals(type)'>
			  		<s:set name="tmp_remark" value="true" />
			  	</s:if>
			  	<s:if test='"2".equals(type)'>
			  		<s:set name="tmp_screenshot" value="true" />
			  	</s:if>
			  	<s:if test='"3".equals(type)'>
			  		<s:set name="tmp_other" value="true" />
			  	</s:if>
			  	<s:if test='"4".equals(type)'>
			  		<s:set name="tmp_apk" value="true" />
			  	</s:if>
			  </s:iterator>
					<table width="90%" id="general-table" align="center">
						<tr>
							<td class="label2">上传游戏：</td>
							<td>
								<form>
									<div id="queue"></div>
									<input id="appfile" name="appfile" type="file" />
								</form> 
								<script type="text/javascript">
									$(function() {
										$('#appfile')
												.uploadify(
														{
															'formData' : {
																'timestamp' : '321',
																'model.appnumber':'<s:property value="model.appnumber" />',
																'model.appversionnumber':'<s:property value="model.appversionnumber" />'
															},
															'swf' : 'js/jquery/uploadify/uploadify.swf',
															'uploader' : 'appversion_uploadapp.do',
															'buttonText' : '上传游戏...',
															'fileSizeLimit' : '100MB',
															'fileTypeDesc' : 'Apk Files',
															'fileTypeExts' : '*.apk',
															'successTimeout': 3000,
															'onUploadSuccess' : function(file,data,response) {
																if(data.indexOf("package")!=-1){
																	alert("请检查包名是否正确！！");
																}else{
																	var div = document.getElementById("appfilediv");
																	var divv = div.innerHTML;
																	if(divv.indexOf("无")!=-1){
																		div.innerHTML = data;
																	}else{
																		div.innerHTML = divv+"&nbsp;"+data;
																	}
																}
																
															},
															'cancel' : 'false'
														});
									});
								</script>
							</td>
						</tr>
						<tr>
							<td class="label2"></td>
							<td>
								<div id="appfilediv">
								<s:if test="tmp_apk">
							 	<s:iterator  value="aslist" status="i">
                        		<s:if test='"4".equals(type)'>
                        			<div class="imgDiv<s:property value="id"/>" onmouseover="imgdivon('deleteimg<s:property value="id"/>','0')" onmouseout="imgdivon('deleteimg<s:property value="id"/>','1')" style="display : inline-block;position : relative;">
							    		<a id="<s:property value="id"/>" target="_blank" href="app_downscreenshot.do?appscreenshotid=<s:property value="id" />" ><s:property value="imgname" /></a>
							    		<a href="javascript:void(0);" onclick="deleteappscreenshot('<s:property value="id"/>')">
											<img id="deleteimg<s:property value="id"/>" src="images/xxxxx.PNG" class="delete" style="position : absolute;top : 0px;right : 0px;width : 15px;height : 15px;display:none;"/>
							    		</a>
									</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								</s:if>
                        		</s:iterator>
                        		</s:if>
                        		<s:else>无</s:else>
								</div>
							</td>
						</tr>
						<tr>
							<td class="label2">上传图标：</td>
							<td>
								<form>
									<div id="queue"></div>
									<input id="iconfile" name="iconfile" type="file" />
								</form> 
								<script type="text/javascript">
									$(function() {
										$('#iconfile')
												.uploadify(
														{
															'formData' : {
																'timestamp' : '321',
																'model.appnumber':'<s:property value="model.appnumber" />',
																'model.appversionnumber':'<s:property value="model.appversionnumber" />'
															},
															'swf' : 'js/jquery/uploadify/uploadify.swf',
															'uploader' : 'appversion_uploadicon.do',
															'buttonText' : '上传图标...',
															'fileTypeDesc' : 'Image Files',
															'fileTypeExts' : '*.gif; *.jpg; *.png',
															'successTimeout': 3000,
															'onUploadSuccess' : function(file, data,response) {
																var div = document.getElementById("appicondiv");
																var divv = div.innerHTML;
																if(divv.indexOf("无")!=-1){
																	div.innerHTML = data;
																}else{
																	div.innerHTML = divv+"&nbsp;"+data;
																}
															},
															'cancel' : 'false'
														});
									});
								</script>
							</td>
						</tr>
						<tr>
							<td class="label2"></td>
							<td>
								<div id="appicondiv">
									<s:if test="tmp_icon">
								 	<s:iterator  value="aslist" status="i">
	                        		<s:if test='"0".equals(type)'>
	                        			<div class="imgDiv<s:property value="id"/>" onmouseover="imgdivon('deleteimg<s:property value="id"/>','0')" onmouseout="imgdivon('deleteimg<s:property value="id"/>','1')" style="display : inline-block;position : relative;">
											<img style="width:100px;heigth:100px" id="<s:property value="id"/>" src="app_d.do?appscreenshoturl=icon/<s:property value="imgrename"/>"/>
								    		<a href="javascript:void(0);" onclick="deleteappscreenshot('<s:property value="id"/>')">
												<img id="deleteimg<s:property value="id"/>" src="images/xxxxx.PNG" class="delete" style="position : absolute;top : 0px;right : 0px;width : 20px;height : 20px;display:none;"/>
								    		</a>
											<div id="filename<s:property value="id"/>" style="clear:both;text-align:center;margin: 3px 0px 3px 0px"><a title="点击下载" href="app_downscreenshot.do?appscreenshotid=<s:property value="id" />" target="_blank"><s:property value="imgname" /></a></div>
										</div>
									</s:if>
	                        		</s:iterator>
	                        		</s:if><s:else>无</s:else>
	                            </div>
							</td>
						</tr>
						<tr>
                        <td style="vertical-align: top;" class="label2">游戏描述： </td>
                        <td>
                        <s:if test="isUpdate.equals('true')">
                        	<form>
								<div id="queue"></div>
								<input id="remarkfile" name="remarkfile" type="file"/>
							</form>
							<script type="text/javascript">
								$(function() {
									$('#remarkfile').uploadify({
										'formData'     : {
											'timestamp' : '321',
											'model.appnumber':'<s:property value="model.appnumber"/>',
											'model.appversionnumber':'<s:property value="model.appversionnumber"/>'
										},
										'swf'      : 'js/jquery/uploadify/uploadify.swf',
										'uploader' : 'appversion_uploadremark.do',
										'buttonText' : '上传描述...',
										'fileTypeDesc' : 'Text Files',
								        'fileTypeExts' : '*.txt',
								        'successTimeout': 3000,
										'onUploadSuccess' : function(file, data, response) {
											var div = document.getElementById("appremarkdiv");
											var divv = div.innerHTML;
											if(divv.indexOf("无")!=-1){
												div.innerHTML = data;
											}else{
												div.innerHTML = divv+"&nbsp;"+data;
											}
									    }
									    ,
									    'cancel':'false'
									});
								});
							</script>
							</s:if>
							 <div id="appremarkdiv">
							 <s:if test="tmp_remark">
							 	<s:iterator  value="aslist" status="i">
                        		<s:if test='"1".equals(type)'>
                        			<div class="imgDiv<s:property value="id"/>" onmouseover="imgdivon('deleteimg<s:property value="id"/>','0')" onmouseout="imgdivon('deleteimg<s:property value="id"/>','1')" style="display : inline-block;position : relative;">
							    		<a id="<s:property value="id"/>" target="_blank" href="app_d.do?model.refilename=remark.txt&appscreenshoturl=remark/<s:property value="imgrename"/>" ><s:property value="imgname" /></a>
							    		<a href="javascript:void(0);" onclick="deleteappscreenshot('<s:property value="id"/>')">
											<img id="deleteimg<s:property value="id"/>" src="images/xxxxx.PNG" class="delete" style="position : absolute;top : 0px;right : 0px;width : 15px;height : 15px;display:none;"/>
							    		</a>
									</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								</s:if>
                        		</s:iterator>
                        		</s:if><s:else>无</s:else>
                            </div>
                            <br />
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: top;" class="label2">游戏截图： </td>
                        <td>
                        <s:if test="isUpdate.equals('true')">
                            <form>
								<div id="queue"></div>
								<input id="filescreenshot" name="filescreenshot" type="file"/>
							</form>
						
							<script type="text/javascript">
								$(function() {
									$('#filescreenshot').uploadify({
										'formData'     : {
											'timestamp' : '321',
											'model.appnumber':'<s:property value="model.appnumber"/>',
											'model.appversionnumber':'<s:property value="model.appversionnumber"/>'
										},
										'swf'      : 'js/jquery/uploadify/uploadify.swf',
										'uploader' : 'appversion_uploadscreenshot.do',
										'buttonText' : '添加截图...',
										'fileTypeDesc' : 'Image Files',
								        'fileTypeExts' : '*.gif; *.jpg; *.png',
								        'successTimeout': 3000,
										'onUploadSuccess' : function(file, data, response) {
											var div = document.getElementById("filescreenshotdiv");
									        div.innerHTML = data;
									        reload();
									    }
									    ,
									    'cancel':'false'
									});
								});
							</script>
							</s:if>
                        </td>
                    </tr>
                    <tr>
                        <td class="label2"> </td>
                        <td>
                        	<div id="filescreenshotdiv">
                        	<jsp:include page="_uploadscreenshot.jsp" />
                        	</div>
                        </td>
                    </tr>
                    <tr>
                        <td style="vertical-align: top;" class="label2">其他： </td>
                        <td>
                        <s:if test="isUpdate.equals('true')">
                        	<form>
								<div id="queue"></div>
								<input id="remark1file" name="remarkfile" type="file"/>
							</form>
							<script type="text/javascript">
								$(function() {
									$('#remark1file').uploadify({
										'formData'     : {
											'timestamp' : '321',
											'model.appnumber':'<s:property value="model.appnumber"/>',
											'model.appversionnumber':'<s:property value="model.appversionnumber"/>'
										},
										'swf'      : 'js/jquery/uploadify/uploadify.swf',
										'uploader' : 'appversion_uploadremark1.do',
										'buttonText' : '其他...',
								        'successTimeout': 3000,
										'onUploadSuccess' : function(file, data, response) {
											var div = document.getElementById("appremark1div");
											var divv = div.innerHTML;
											if(divv.indexOf("无")!=-1){
												div.innerHTML = data;
											}else{
												div.innerHTML = divv+"&nbsp;"+data;
											}
									    }
									    ,
									    'cancel':'false'
									});
								});
							</script>
							</s:if>
							 <div id="appremark1div">
							 <s:if test="tmp_other">
							 	<s:iterator  value="aslist" status="i">
                        		<s:if test='"3".equals(type)'>
                        			<div class="imgDiv<s:property value="id"/>" onmouseover="imgdivon('deleteimg<s:property value="id"/>','0')" onmouseout="imgdivon('deleteimg<s:property value="id"/>','1')" style="display : inline-block;position : relative;">
							    		<a id="<s:property value="id"/>" target="_blank" href="app_d.do?model.refilename=<s:property value="imgname" />&appscreenshoturl=remark1/<s:property value="imgrename"/>" ><s:property value="imgname" /></a>
							    		<a href="javascript:void(0);" onclick="deleteappscreenshot('<s:property value="id"/>')">
											<img id="deleteimg<s:property value="id"/>" src="images/xxxxx.PNG" class="delete" style="position : absolute;top : 0px;right : 0px;width : 15px;height : 15px;display:none;"/>
							    		</a>
									</div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
								</s:if>
                        		</s:iterator>
                        		</s:if><s:else>无</s:else>
                            </div>
                            <br />
                        </td>
                    </tr>
					</table>
					</s:if>
				<s:else>
				<table width="90%" id="general-table" align="center">
					<tbody>
						<tr>
							<td class="label2">发行版本编码：</td>
							<td>
								<s:property value="model.appversionnumber" /><input type="hidden" id="model.appversionnumber" name="model.appversionnumber" value="<s:property value="model.appversionnumber" />" />
							</td>
						</tr>
						<tr>
							<td class="label2">发行版本名称：</td>
							<td><input type="text" name="model.appname"	id="model.appname" value="<s:property value="model.appname"/>" style="float: left;" size="30" /> 
								<span class="require-field">*</span>&nbsp;
								<span id="CompareValidator1" style="color: Red; visibility: hidden;">不能为空</span>
							</td>
						</tr>
						<tr>
							<td class="label2">发行版本包名：</td>
							<td><input type="text" name="model.apppackage"	id="model.apppackage" value="<s:property value="model.apppackage"/>" style="float: left;" size="30" /> 
								<span class="require-field">*</span>
								<span id="CompareValidator4" style="color: Red; visibility: hidden;">不能为空</span>
							</td>
						</tr>
						<tr>
							<td class="label2">发行版本版本：</td>
							<td>
								<input type="text" name="model.appversion"	id="model.appversion" value="<s:property value="model.appversion"/>" style="float: left;" size="30" />
							</td>
						</tr>
						<input type="hidden" name="model.appentry" id="model.appentry" value="<s:property value="model.appentry"/>" />
						<tr>
							<td style="vertical-align: top;" class="label"><font color="red">(*)</font>开通平台：</td>
							<td class="label">
							  <div class="list-div">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr style="visibility: true">
											<s:iterator value="terraceNameList" status="tn">
												<s:if test="#tn.index>0&&#tn.index%5==0"></tr><tr></s:if>
												<td width="10%" class="table_w2" align="left">&nbsp;&nbsp;
													<input type="checkbox" id="checkboxs" name="ckb_province" onclick="insertTerrace(this);" appnumber="<s:property value="model.appnumber"/>" appversionId="<s:property value="model.id"/>" terraceId="<s:property value="id"/>" value="<s:property value="id" />"
													<s:if test="terraceIds.indexOf(','+id+',')!=-1">checked</s:if>>&nbsp;<s:property value="operatorsName" />
												</td>
											</s:iterator>
										</tr>
									</table>
								</div>
								<div class="list-div">
									<table id="mytb" width="100%" style="display: block;" cellspacing="2" cellpadding="2">
										<thead>
										<tr>
											<td class="lable1" width="30%" align="center">平台名称</td>
											<td class="lable1" width="70%" align="center">计费点</td>
										</tr>
										</thead>
										<s:iterator value="terracelist" status="t">	
											<tr id="tr_terrace_<s:property value="terraceId" />" style="width: 100%;">
												<td class="lable1" width="25%" align="center"><s:property value="operatorsName" /></td>
												<td class="lable1" align="center">
													<table>
													<tr>
													<!-- 计费平台关联信息 -->
													<s:iterator value="appPointList" status="ptn">			
														 <s:if test="#ptn.index>0&&#ptn.index%4==0"></tr><tr></s:if>
															<td nowrap="nowrap"	style="border-right: 1px #BBDDE5 solid; border-bottom: 1px #BBDDE5 solid;">
																<input type="checkbox" onclick="ckbox1(this);" id="appointids" name="ckb_apppoint" appversionId="<s:property value="model.id"/>" apppointId="<s:property value="id" />" terraceId="<s:property value="terracelist.get(#t.index).terraceId" />" value="<s:property value="terracelist.get(#t.index).terraceId+'_'+id" />"<s:if test="apppointids.indexOf(','+terracelist.get(#t.index).terraceId+'_'+id+',')!=-1">checked</s:if>/>&nbsp;
																<s:property value="pointofbillingname" />|<s:property value="fee" />
															</td>
														</s:iterator>
														</tr>
													  </table>
													</td>
												</tr>
											</s:iterator>
										</table>
									</div>
								</td>
							</tr>
						<tr>
							<td class="label2" colspan="2">
								<div class="button-div">
								<s:if test="isUpdate.equals('true')">
									<input type="submit" value=" 确定 " class="button" /> 
									<input type="reset" value=" 重置 " class="button" />
								</s:if>
								<s:else>
									<input type="button" onclick="window.location.href='appversion_index.do?app.appnumber=<s:property value="app.appnumber"/>&cpid=<s:property value="cpid"/>&categoryparentid=<s:property value="categoryparentid"/>&appName=<s:property value="appName"/>'" value=" 返回 " class="button" /> 
								</s:else>
								</div>
							</td>
						</tr>
					</tbody>
				</table>
				<input type="hidden" id="model.appfilename"	name="model.appfilename" value="<s:property value="model.appfilename"/>" />
				<input type="hidden" id="model.refilename" name="model.refilename" value="<s:property value="model.refilename"/>" /> 
				<input type="hidden" id="model.appfilesrc" name="model.appfilesrc" value="<s:property value="model.appfilesrc"/>" />
				</s:else>
				<!-- 通用信息end -->
			</div>
		</div>
		<!-- end goods form -->
	</form>
	<script type="text/plain" id="terracetag"></script>
	<script type="text/javascript" src="js/tab.js"></script>
	<script type="text/javascript" src="js/validator.js"></script>
	
	<script type="text/javascript">
	var arry=new Array();
	var oldarry =new Array();
	var pointArry = new Array();
	var oldpointarry = new Array();
	 Array.prototype.indexOf = function(val) {
         for (var i = 0; i < this.length; i++) {
             if (this[i] == val) return i;
         }
         return -1;
     };
     Array.prototype.remove = function(val) {
         var index = this.indexOf(val);
         if (index > -1) {
             this.splice(index, 1);
         }
     };
     // 把选中了的平台放到oldarry中
     goInit();
     function goInit(){
     	$("input[id='checkboxs']:checkbox").each(function(){ 
             if($(this).attr("checked")){
            	 oldarry.push($(this).val());
             }
         });
     }
     arry=oldarry;
     // 把选中了的计费点放到oldpointarry中
     pointgoInit();
     function pointgoInit(){
    	 $("input[id='appointids']:checkbox").each(function(){
    		 if($(this).attr("checked")){
    			 oldpointarry.push($(this).val());
    		 }
    	 });
     }
     pointArry=oldpointarry;
	function validate() {
		if(formvalidator("all")){
			$("input[type=reset]").hide();
			$("input[type=submit]").val("正在提交，请稍后。。。。").attr("disabled",true);
			var str="",
				ckb_provinces=$("input[name=ckb_province]:checked"),
				ckb_apppoints=$("input[name=ckb_apppoint]:checked");
			for(var i=0;i<ckb_provinces.length;i++){
				var tmp_province=$(ckb_provinces[i]);
				str+="<input type='hidden' name='appversionTerraceInfos["+i+"].appversionId' value='"+tmp_province.attr("appversionId")+"'/>";
				str+="<input type='hidden' name='appversionTerraceInfos["+i+"].terraceId' value='"+tmp_province.attr("terraceId")+"'/>";
			}
			for(var i=0;i<ckb_apppoints.length;i++){
				var tmp_apppoint=$(ckb_apppoints[i]);
				str+="<input type='hidden' name='apppointTerraceInfos["+i+"].appversionId' value='"+tmp_apppoint.attr("appversionId")+"'/>";
				str+="<input type='hidden' name='apppointTerraceInfos["+i+"].terraceId' value='"+tmp_apppoint.attr("terraceId")+"'/>";
				str+="<input type='hidden' name='apppointTerraceInfos["+i+"].apppointId' value='"+tmp_apppoint.attr("apppointId")+"'/>";
			}
			$("#theForm").append(str);
			return true;
		}
		return false;
	}
	function formvalidator(obj) {	
		// 校验平台
		/* for(var i=0;i<arry.length;i++){
			var dd =document.getElementById(arry[i]).value;
			if(dd.length==0){
				alert("业务代码不能为空!");
				return false;
			}
		} */
		// 校验计费点
		/* for(var j=0 ;j<pointArry.length; j++){			
			for(var i=0;i<arry.length;i++){
				var ss=document.getElementById(pointArry[j]).value;
				var a=pointArry[j].split("_");
				if(arry[i] !=0 && arry[i]==a[0] && ss.length == 0){
					alert("计费点代码不能为空!");
					return false;
				}
			}
		} */
		var controlId = "all";
		if (typeof (obj) != "string") {
			controlId = obj.id;
		}
		if (controlId == "all" || controlId == "model.appname") {
			if (Utils.trim(document.getElementById("model.appname").value) == "") {
				document.getElementById("CompareValidator1").style.visibility = "visible";
				return false;
			} else {
				document.getElementById("CompareValidator1").style.visibility = "hidden";
			}
		}
		if (controlId == "all" || controlId == "model.apppackage") {
			if (Utils.trim(document.getElementById("model.apppackage").value) == "") {
				document.getElementById("CompareValidator4").style.visibility = "visible";
				return false;
			} else {
				document.getElementById("CompareValidator4").style.visibility = "hidden";
			}
		}
		return true;
	}
	function manage_sp_checkallprovince(obj) {
		var ckbs = document.getElementsByName("ckb_province");
		if (obj.checked == true) {
			for ( var n = 0; n < ckbs.length; n++) {
				arry.push(ckbs[n].value);
				ckbs[n].checked = true;
				document.getElementById("tr_terrace_" + ckbs[n].value).style.display = "";
			}
		} else {
			for ( var n = 0; n < ckbs.length; n++) {
				arry.remove(ckbs[n].value);
				for(var j=0 ;j<pointArry.length; j++){
					var a=pointArry[j].split("_");
					if(obj.value==a[0])
						{
							pointArry.remove(pointArry[j]);
						}
				}
				ckbs[n].checked = false;
				document.getElementById("tr_terrace_" + ckbs[n].value).style.display = "none";
			}
		}
	}
	function ckbox(obj) {
		if (obj.checked) {
			var flag=true;
		    $.ajax({
		    	url:"appversion_chkTerrace.do",
		    	async:false,
		    	data:{
		    		'model.appnumber':'<s:property value="model.appnumber" />',
		    		'terraceIds':obj.value
		    	},
		    	success:function(data){
		    		if(data.indexOf("false")!=-1){
			    		if(!confirm("平台添加重复，请再次确认！！")){
			    			obj.checked=false;
			    			flag=false;
			    		}
			    	}
		    	}
		    });
		    if(flag){
		    	arry.push(obj.value);
				document.getElementById("tr_terrace_" + obj.value).style.display = "";
		    }
			return true;
		} else {
			arry.remove(obj.value);				
			for(var j=0 ;j<pointArry.length; j++){
				var a=pointArry[j].split("_");
				if(obj.value==a[0])
					{
						pointArry.remove(pointArry[j]);
					}
			}
			document.getElementById("tr_terrace_" + obj.value).style.display = "none";
			return false;
		}
		
	}
	function ckbox1(obj) {
		if (obj.checked) {
			pointArry.push(obj.value);
			return true;
		} else {
			pointArry.remove(obj.value);
			return false;
		}
	}
	function imgdivon(deleteimgid,type)
    {
        if(type==0)
        {
			document.getElementById(deleteimgid).style.display="";  
        }
        if(type==1)
        {
        	document.getElementById(deleteimgid).style.display="none";  
        }
    }
    function deleteappscreenshot(id)
    {
        
        if (confirm("确定删除？"))
        {
           $.get("app_deletescreenshot.do?appscreenshotid="+id, 
           function(data) 
           { 
              if(data.indexOf('ok')>-1)
              {
            	  if(document.getElementById("filename"+id)){
            	 	 document.getElementById(id).parentNode.removeChild(document.getElementById("filename"+id));
            	  }
            	  document.getElementById(id).parentNode.removeChild(document.getElementById(id));
              }
              
           });
        }
    }
    function reload(){
   	 jQuery().prepare_slider(); 
   	jQuery('#slider_list > li').over();
   	//=======intro================
   	var slider_link = jQuery('#right_but');
   	var slider_link_index = 1;
   	var slider_count = jQuery('#slider_list > li').size();	

   	function slider_intro(){
   		if(slider_link_index <= slider_count){
   			slider_link.trigger('click');
   			slider_link_index++;
   			setTimeout(function(){slider_intro();}, 6000); //select change time
   		}
   	}
   	setTimeout(function(){slider_intro();}, 6000);
    //===============
   	
   	jQuery('#left_but').hover(
   	   function () {
   		 jQuery(this).addClass("over");
   	   },
   	   function () {
   		 jQuery(this).removeClass("over");
   	   });
   	
   	jQuery('#right_but').hover(
   	   function () {
   		 jQuery(this).addClass("over");
   	   },
   	   function () {
   		 jQuery(this).removeClass("over");
   	   });
   	
   	jQuery('.cms-home .products-grid li').hover(
   	   function () {
   		 jQuery(this).find('.product-name').stop(true, true).slideDown("slow");
   	   },
   	   function () {
   		 jQuery(this).find('.product-name').hide("slow");
   	   });
   }
    
    function insertTerrace(obj){
    	if($(obj).attr("checked")){
    		var flag=true;
		    $.ajax({
		    	url:"appversion_chkTerrace.do",
		    	async:false,
		    	data:{
		    		'model.appnumber':$(obj).attr("appnumber"),
		    		'terraceIds':$(obj).attr("terraceId")
		    	},
		    	success:function(data){
		    		if(data.indexOf("false")!=-1){
			    		if(!confirm("平台添加重复，请再次确认！！")){
			    			obj.checked=false;
			    			flag=false;
			    		}
			    	}
		    	}
		    });
		    if(flag){
		    	$.get("appversion_insertTerrace.do?terraceid="+$(obj).attr("terraceId")+"&model.appnumber="+$(obj).attr("appnumber"),function(data){
	        		$("#mytb").append(data);
	        	});
		    }
    		
    	}else{
    		$("#tr_terrace_"+$(obj).attr("terraceId")).remove();
    	}
    	
    }
</script>
</body>
</html>
